package com.grape.ciq.api.redbook.base;

import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import com.grape.ciq.api.redbook.ApiRuleException;

@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class XHSRequest<T extends XHSResponse> implements Serializable {

    private static final long serialVersionUID = -2647939793172025595L;

    public abstract void check() throws ApiRuleException;

    public abstract String getMethodUrl();

    public Class<T> getResponseClass() {
        return (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    }

    /**
     * getParams:(条件参数，需要排序的参数). <br/>
     *
     * @author liuyinsong
     * @return
     */
    public abstract Map<String, Object> getParams();

    public abstract String getMethod();

    /**
     * getParams:(URL参数，不需要排序的参数). <br/>
     *
     * @author liuyinsong
     * @return
     */
    public abstract String getUrlParams();
}
